//
//  KoiProgressView.swift
//  KoiAccounting
//
//  Created by 纪洪文 on 22.04.25.
//

import Foundation
import SwiftUI

struct KoiLinearProgressViewStyle: ProgressViewStyle {
    var tintColor: Color = Color.koiColorPrimary
    var backgroundColor: Color = Color.koiColorDivider

    func makeBody(configuration: Configuration) -> some View {
        let fractionCompleted = configuration.fractionCompleted ?? 0

        GeometryReader { geometry in
            ZStack(alignment: .leading) {
                Capsule()
                    .fill(backgroundColor)

                Capsule()
                    .fill(tintColor)
                    .frame(width: fractionCompleted * geometry.size.width)

            }
            .frame(width: geometry.size.width, height: geometry.size.height)
        }
    }
}
